﻿
@{
    ViewBag.Title = "NewList";
    Layout = "~/Views/Shared/_Head.cshtml";
}
<script src="~/Content/PC/layui/layui.js"></script>
<script src="~/Scripts/comm.js"></script>
<script src="~/Scripts/jquery.url.js"></script>
<script>
    var NewTypename = jQuery.url.param("NewTypeName");
    var NewTypeID = jQuery.url.param("NewTypeID");
    $(function () {
        var html = '<a href="/Home/index">首页</a>'
        if (NewTypename) {
            html += '<span>&gt;</span><a href="/News/NewList?NewTypeID=' + NewTypeID + '&NewTypeName=' + NewTypename + '">' + NewTypename + '</a>';
        } else {
            html += '<span>&gt;</span><a href="javascrip:void(0)">新闻资讯</a>'
        }
        NewType();
        loadlist();
    })
    function NewType() {
        $.post('/News/NewsTypeList', function (data) {
            if (data.success) {
                var html = "";
                for (var i = 0; i < data.data.length; i++) {
                    var model = data.data[i];
                    html += '<li><a href="/News/NewList?NewTypeID=' + model.ID + '&NewTypeName=' + model.TypeName + '">' + model.TypeName + '</a></li>';
                }
                $('#newType').html(html);
                $('#newType li').each(function () {
                    $(this).removeClass("nows");
                    if ($(this).children("a").html() == NewTypename) {
                        $(this).addClass("nows");
                    }
                })
            }
        })
    }
    function loadlist() {
        layui.use('laytpl', function () {
            var laytpl = layui.laytpl;
            $("#productPage").html("");
            $.post('/News/NewListPage', { TypeID: NewTypeID }, function (data) {
                if (data.success) {
                    totalPage = data.totalPage;
                    page();
                    var getTpl = $('#newInfo').html();
                    $.each(data.result, function (i, r) {
                        r.Index = i + 1;
                        laytpl(getTpl).render(r, function (html) {
                            $('#NewsListPage').append(html);
                        });
                    })
                }
            })
        });
    }
</script>
<script type="text/template" id="newInfo">
    <li>
        <a href="/News/NewInfo?ID={{d.NewId}}">
            <img src="{{d.Image}}"><span>{{d.Title}}</span>
            <p>{{d.ShortTitle}}</p>
        </a>
    </li>
</script>
<div class="container">
    <div class="page" id="BreadCrumbs"><a href="/Home/index">首页</a><span>&gt;</span><a href="javascrip:void(0)">新闻资讯</a></div>
    <section class="clearfix">
        <div class="fl list_a">
            <ul class="list_a1 clearfix" id="newType">
                
                @*<li class="nows"><a href="#">鉴赏百科</a></li>
                <li><a href="#">行业资讯</a></li>
                <li><a href="#">趣闻轶事</a></li>*@
            </ul>

            <ul class="list_h" id="NewsListPage">

            </ul>
            <div class="clearfix mar_tb">
                <div id="page" style="margin-left: 300px;"></div>
            </div>
        </div>
        <div class="fl list_b">
            <h2>浏览排行</h2>
            <ul>
                @if (ViewBag.NewSorting != null)
                {
                    int i = 1;
                    foreach (Gtkj.CMS.Model.NewInfo item in ViewBag.NewSorting)
                    {
                        if (i <= 3)
                        {
                            <li><span class="list_b1">@i</span><a href="/News/NewInfo?ID=@item.NewId">@item.Title</a></li>
                        }
                        else
                        {
                            <li><span>@i</span><a href="/News/NewInfo?ID=@item.NewId">@item.Title</a></li>
                        }
                        i++;
                    }
                }
                
                @*<li><span class="list_b1">2</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>
                <li><span class="list_b1">3</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>
                
                <li><span>5</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>
                <li><span>6</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>
                <li><span>7</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>
                <li><span>8</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>
                <li><span>9</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>
                <li><span>10</span><a href="article.html">寿山石中那些让人爱不释手的老工寿山石中那些让人爱不释手的老工</a></li>*@
            </ul>
        </div>
    </section>
</div>

